package com.xyz.app;

import com.free.ext.logger.FreeLogger;
import com.free.ext.logger.FreeLoggerFactory;
import com.free.ext.spring.context.AppContext;
import com.free.messager.IMessager;
import com.free.messager.MessagerManager;
import com.xyz.eventconsumer.EventConsumer;
import com.xyz.eventoper.EventOperContext;
import com.xyz.shiro.jwt.JwtTools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class XyzFrontRunner implements ApplicationRunner {

    private static FreeLogger LOG = FreeLoggerFactory.getLogger(XyzFrontRunner.class);

    @Autowired
    private EventConsumer eventConsumer;

    @Autowired
    private EventOperContext operContext;

    @Override
    public void run(ApplicationArguments applicationArguments) throws Exception {
        // message 处理
        IMessager mesager = AppContext.getBean(IMessager.class);
        MessagerManager.current().setMessager(mesager);

        JwtTools.getInstance().loadConfig("jwt.properties");

        operContext.init();
        eventConsumer.init();
        //        SmsUtils.config(smsId,smsSerect);
//        addWxAccount();
//        new Thread(()->{
//            initStrategyContext();
//        }).start();
    }

}
